<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        /*
            封装继承拷贝函数
                - source：源对象
                - target：目标对象
        */
        function extend(source, target) {
            for (var key in source) {
                target[key] = source[key];
            }
        }

        var o3 = { name: "张三", gender: "男", age: 18 };
        var o4 = {};
        extend(o3, o4);
        o4.name = "李四";
        console.log(o4);
    </script>
</body>
</html>